package com.flyan.game.motafx.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * z轴图层索引枚举
 *
 * @author flyan
 * @version 1.0
 * @email flyan_by_chenu@sina.com
 * @since 2025/1/31
 */
@AllArgsConstructor
@Getter
public enum ZLayerEnum {

    /* 低图层 */
    LOW(0),
    LOW1(1),
    LOW2(2),
    /* 普通图层 */
    MID(3),
    /* 普通-1 勇士就在此图层 */
    MID1(4),
    MID2(5),
    /* 高图层 */
    HIGH(6),
    HIGH1(7),
    ;

    private final int index;

    /**
     * @return 图层数量
     */
    public static int numberLayers() {
        return values().length;
    }

    public static ZLayerEnum getByIndex(int index) {
        for (ZLayerEnum e : values()) {
            if (e.getIndex() == index) {
                return e;
            }
        }
        return null;
    }

}
